<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-input placeholder="搜索" v-model="queryInfo.query">
        <el-button slot="append" icon="el-icon-search"></el-button>
      </el-input>
      <el-table :data="orderTableList" style="width: 100%">
        <el-table-column type="index" label="#" width="width">
        </el-table-column>
        <el-table-column prop="order_number" label="订单编号" width="width">
        </el-table-column>
        <el-table-column prop="order_price" label="订单价格" width="width">
        </el-table-column>
        <el-table-column prop="pay_status" label="是否付款" width="width">
          <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.pay_status === '1'"
              >是</el-tag
            >
            <el-tag type="success" v-else>否</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="is_send" label="是否发货" width="width">
        </el-table-column>
        <el-table-column prop="create_time" label="下单时间" width="width">
        </el-table-column>
        <el-table-column label="操作" width="width">
          <template slot-scope="scope">
            <el-button type="primary" size="small" @click="editOrder(scope.row)"
              ><i class="el-icon-edit"></i
            ></el-button>
            <el-button
              type="warning"
              size="small"
              @click="showOrderPress(scope.row)"
              ><i class="el-icon-location"></i
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-dialog
      title="修改地址"
      :visible.sync="editDialogVisible"
      @closed="editDialogClosed"
    >
      <el-form
        ref="editAddressFormRef"
        :model="editAddressForm"
        label-width="80px"
      >
        <el-form-item label="省市县/区">
          <el-cascader :options="cityData" v-model="editAddressForm.address1">
          </el-cascader>
        </el-form-item>
        <el-form-item label="详细地址">
          <el-input
            v-model="editAddressForm.address2"
            placeholder="placeholder"
          >
          </el-input>
        </el-form-item>
      </el-form>

      <div slot="footer">
        <el-button @click="editDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="editDialogVisible = false"
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <el-dialog title="查看进度" :visible.sync="showDialogVisible">

    </el-dialog>
  </div>
</template>

<script>
import citydata from '@/api/citydata'
export default {
    data() {
        return {
            
            orderTableList:[],
            total:0,
            queryInfo:{
                query:'',
                pagenum:1,
                pagesize:5,
                // user_id:'',
                // pay_status:'',
                // is_send:'',
                // order_fapiao_title:'',
                // order_fapiao_company:'',
                // order_fapiao_content:'',
                // consignee_addr:''

            },
            editDialogVisible:false,
            showDialogVisible:false,
            editAddressForm:{
                address1:[],
                address2:'',
            },
            cityData:citydata,
            progressInfo:{}
            


            
        }
    },
    created() {
        this.getOrderList()
    },
    computed: {
        

    },
    methods: {
        async getOrderList(){
            const {data:res} =await this.$http.get('orders',{params:this.queryInfo})
            if(res.meta.status!=200){
                return this.$message.error('获取订单列表失败')
            }
            this.total = res.data.total
            this.orderTableList = res.data.goods
        },
        editOrder(){
            this.editDialogVisible=true

        },
       

        editDialogClosed(){
            this.editAddressForm.address1=[]
            this.editAddressForm.address2=''
        },
        async showOrderPress(){
     

            this.showDialogVisible = true
        }

        
    },

}
</script>

<style scoped>
.el-input {
  max-width: 400px;
}
.el-cascader {
  width: 77%;
}
</style>